package mtgGameObjects.mtgGameTypes.mtgGameTypeMana;

import mtgGameObjects.mtgGameTypes.MtgGameTypes;

public abstract class MtgGameTypeMana implements MtgGameTypes {
	
	// Number of mana of this type in the object
	private int quantity;
	// Converted manacost of this mana type
	private int unitaryManaCost;
	// Normalized symbol of one instance of this mana type
	private String symbol;
	
	/**
	 * COnstructor
	 */
	public MtgGameTypeMana() {
		super();
	}
	
	/**
	 * Constructor : creates quantity mana of this type
	 * @param quantity
	 */
	public MtgGameTypeMana(int quantity){
		super();
		this.quantity = quantity;
	}

	/**
	 * Adds q mana of this type to objetc
	 * @param q
	 */
	public void addQuantity(int q){
		this.quantity += q;
		this.renewSymbol();
	}
	
	/**
	 * Rebuilds the symbol of this mana quantity
	 */
	public abstract void renewSymbol();
	
	public void setQuantity(int q){
		this.quantity = q;
	}
	
	/**
	 * Sets unitary manacost of this manatype
	 * @param u
	 */
	public void setUnitaryManaCost(int u){
		this.unitaryManaCost = u;
	}
	
	/**
	 * Returns normalized symbol of this manas quantity
	 * @return
	 */
	public String getNormalizedSymbol(){
		String nSymbol = "";
		for (int i=0 ; i<this.quantity; i++){
			nSymbol = nSymbol + this.symbol;
		}
		return nSymbol;
	}
	
	/**
	 * Sets this manatypes symbol
	 * @param s
	 */
	public void setSymbol(String s){
		this.symbol = s;
	}

	/**
	 * Gets this manatypes symbol
	 * @return
	 */
	public String getSymbol(){
		return this.symbol;
	}
	
	public int getQuantity(){
		return this.quantity;
	}
	
	/**
	 * Gets this manas quantitys converted manacost
	 * @return
	 */
	public int getConvertedManaCost(){
		return quantity*unitaryManaCost;
	}

}
